package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.DbMerchantMapper;
import com.ruoyi.system.domain.DbMerchant;
import com.ruoyi.system.service.IDbMerchantService;

/**
 * 商家Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-08
 */
@Service
public class DbMerchantServiceImpl implements IDbMerchantService 
{
    @Autowired
    private DbMerchantMapper dbMerchantMapper;

    /**
     * 查询商家
     * 
     * @param id 商家主键
     * @return 商家
     */
    @Override
    public DbMerchant selectDbMerchantById(Long id)
    {
        return dbMerchantMapper.selectDbMerchantById(id);
    }

    /**
     * 查询商家列表
     * 
     * @param dbMerchant 商家
     * @return 商家
     */
    @Override
    public List<DbMerchant> selectDbMerchantList(DbMerchant dbMerchant)
    {
        return dbMerchantMapper.selectDbMerchantList(dbMerchant);
    }

    /**
     * 新增商家
     * 
     * @param dbMerchant 商家
     * @return 结果
     */
    @Override
    public int insertDbMerchant(DbMerchant dbMerchant)
    {
        dbMerchant.setCreateTime(DateUtils.getNowDate());
        return dbMerchantMapper.insertDbMerchant(dbMerchant);
    }

    /**
     * 修改商家
     * 
     * @param dbMerchant 商家
     * @return 结果
     */
    @Override
    public int updateDbMerchant(DbMerchant dbMerchant)
    {
        dbMerchant.setUpdateTime(DateUtils.getNowDate());
        return dbMerchantMapper.updateDbMerchant(dbMerchant);
    }

    /**
     * 批量删除商家
     * 
     * @param ids 需要删除的商家主键
     * @return 结果
     */
    @Override
    public int deleteDbMerchantByIds(Long[] ids)
    {
        return dbMerchantMapper.deleteDbMerchantByIds(ids);
    }

    /**
     * 删除商家信息
     * 
     * @param id 商家主键
     * @return 结果
     */
    @Override
    public int deleteDbMerchantById(Long id)
    {
        return dbMerchantMapper.deleteDbMerchantById(id);
    }
}
